<template>
  <SearchTablePage :search-config="baseTableSearchModel" :table-config="baseTableModel"/>
</template>

<script lang="tsx" setup>
defineOptions({
  name: 'ConsolePermissionPageData',   //全局别名
  title: '菜单管理',   //标题
});
// 接口
import ConsolePermissionApi from '/@/api/console/ConsolePermissionApi.ts';


import FORM_FIELD_TYPE from '/@/constants/FormFieldType';
import VDialog  from '/@/utils/dialogUtil.ts'

const router = useRouter();
const baseTable = ref(null as any);
const baseTableSearch = ref(null as any);
const editRef = ref<any>(null);

// 表格搜索初始化searchModel
const baseTableSearchModel = ref({
  columnCount: 4,
  expandLimit: 6,
  autoFit: true,
  columnWidth: '300px',
  labelPosition: 'left',
  labelWidth: '100px',
  search:async (reset: Boolean) => {  //搜索、重置按钮  回调方法钩子   实现父类 ---夸组件调用


  },
  items: [ //搜索项初始化


    {
      label: "标题",
      field: "title",
      clearable: true,
      type: FORM_FIELD_TYPE.INPUT,

      placeholder:"请输入",

    },

    {
      label: "状态",
      field: "state",
      clearable: true,
      type: FORM_FIELD_TYPE.SELECT,
      config: CommonFormFieldTypeConfig.CommonStatus,


      placeholder:"请输入",

    }
  ],

  buttons: [    //功能区域

    // {
    //   name: "新增",
    //   buttonClass: 'primary',
    //   width: 100,
    //   click: (handlers:object) => {        // 点击回调事件方法钩子，  点击触发
    //
    //     VDialog.open({
    //       title: '新增',
    //
    //       content:{ //内容初始形式
    //         type: 'component', //text:"",预留文本
    //         name:'/console/consolePermission/edit',
    //         query: {  },
    //
    //       },
    //
    //       callBack: (data:any) => {
    //         handlers.refresh()
    //       },
    //       onClose: () => {
    //         console.log("对话框已关闭");
    //       },
    //     });
    //
    //   },
    // },

  ]
})
// 表格初始化Model
const baseTableModel = ref({
  border: true,
  pagination: false,
  inline: true,
  selectable: true,
  isFullscreen: false,
  minWidth: '200px',
  rowKey: 'id',
  treeProps: { children: 'children', hasChildren: 'hasChildren' },
  data: {    //table  初始化
    current: 1,
    size: 10,
    total: 100,
    data: []
  },
  requestData:{api:ConsolePermissionApi.getListData,query:{type: 0}},   //数据源 参数有效性： 'steady|transient'
  columns: [
    {
      label: " ",
      width:90,
    },
    {
      label: "ID",
      field: "id",
      width:120,
    },
    {
      label: "菜单名称",
      field: "menuName"
    },
    {
      label: "图标",
      field: "icon",
      width:160,
    },

    {
      label: "url",
      field: "url",
      width:150,
    },
    {
      label: "排序",
      field: "sort",
      width:80,
    },

    {
      label: "创建时间",
      field: "create_time",
      width:200,
    },
    {
      label: "更新时间",
      field: "update_time",
      width:200,
    },
  ],


  actions: [



  ]

})



onActivated(() => {
})



</script>


